<?php 
$querydetail=mysql_query("SELECT p.IDProject, p.NameProject, p.Description, p.DateStart, p.DateComplete, p.IDManager, p.`Status`, e.FullName 
        	FROM pr_project p,employee e WHERE p.IDProject='".$id."' and p.IDManager = e.IDEmployee LIMIT 1");

$queryLstMember=mysql_query("SELECT c.IDComposition, c.IDEmployee, c.IDProject, c.Position, c.Status, e.UserName, e.FullName,
        		 e.Position as PositionEmp FROM pr_composition c, employee e 
        		 WHERE c.IDProject = '$id' AND c.IDEmployee = e.IDEmployee ");
unset($_SESSION['addTester']);
unset($_SESSION['addCoder']);
unset($_SESSION['listcomposition']);
?>
<link
	href="css/style.css" rel="stylesheet" type="text/css" />

<style>
.cke_contents {
	height: 250px !important;
}
a[title="Browse Server"]{
	display:none !important;
}
a[title="Duyệt trên máy chủ"]{
	display:none !important;
}
a[title="서버 보기"]{
	display:none !important;
}
a[title="Link"]{
	display:none !important;
}
a[title="Liên kết"]{
	display:none !important;
}
a[title="링크"]{
	display:none !important;
}
a[title="Advanced"]{
	display:none !important;
}
a[title="Tab mở rộng"]{
	display:none !important;
}
a[title="자세히"]{
	display:none !important;
}
tr td.cke_bottom{
	display:none !important;
}
</style>

<script type="text/javascript">
	$(document).ready(function(){
		$('.divinvi:not(:last)').hide();
		$('.divinvi:last').show();
		$('#accordion-js').find('.caption').click(function(){
			$(this).next().slideToggle();

		});
		bindEventAfterAjax();
		
	}); 

	function cancelAddErr(thamso){
		var link = "#"+thamso;
		$(link).slideToggle();

		document.getElementById('addnewerror').style.display = 'visible';
		document.getElementById('update').style.visibility='hidden';
		document.getElementById('update').style.display='none';
		document.getElementById('addnewerror').style.display = 'inline';
		CKEDITOR.instances.ncontent.setData('');
		$("#formadderror\\:adderror").htmlarea();

		
	}

	
	function bindEventAfterAjax(){
		$("#report tr:not(#mo):even").addClass("odd");
	    $("#report tr:not(.odd):not(#mo)").hide();
	    $("#report tr:last-child").show();
	    
	    //$("#report tr:not(:last-child).odd").click(function(){
	    	//$(this).hide();
	    	//$(this).next("tr").toggle();
	        
	    //});
	    
		//$("input#showcommand1").click(function(){
	    	//$(this).parent().parent().parent().find("#themcommand").toggle();	    		
	        
	   // });

	   // $("div#themcommand").find("#cancelthemcommand").click(function(){
	    //	$(this).parent().parent().toggle();	
	    //});
	}
	function showcommanderror(indexcomment,idtestproject,id_employee,id,recyclebin,ele){
		commentProjectHide(indexcomment,idtestproject,id_employee,id,recyclebin,ele);
		/*$("#report tr.odd:not(#mo)").show();
		$("#report tr:not(.odd):not(#mo)").hide();
		$(ele).hide();
    	$(ele).next("tr").toggle();*/
	}
	
	function showcommanderrorRecyclebin(indexcomment,idtestproject,id_employee,id,recyclebin,ele){
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
			   // alert(xmlhttp.responseText);
		        $(ele).parent().parent().parent().next("tr").html(xmlhttp.responseText);
		        $("#report tr.odd:not(#mo)").show();
				$("#report tr:not(.odd):not(#mo)").hide();
				$(ele).parent().parent().parent().hide();
		    	$(ele).parent().parent().parent().next("tr").toggle();
		    }
		  }
		var lang = '<?=$_SESSION['lang']?>';
		xmlhttp.open("GET","admin/project/show_comment_rebin.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&idproject="+id+"&recyclebin="+recyclebin+"&newlang="+lang,true);
		xmlhttp.setRequestHeader("Content-Type", "charset=utf-8");
		xmlhttp.send();
	}
	function showthemcommand(ele){
		$(ele).parent().parent().parent().find("#themcommand").toggle();	
	}

	function closethemcommand(ele){
		$(ele).parent().parent().toggle();	
	}
	
	function closeCommand(){
		$("#report tr.odd:not(#mo)").show();
		$("#report tr:not(.odd):not(#mo)").hide();
	}
	
	function javas(ele){
		alert($(ele).parent().find("#ajaxok"))
		$(ele).parent().find("#ajaxok").val("sdfsd");
		
	}
	
	function javass(ele){
		alert(ele);
		alert(ele.parentNode)
		alert(ele.parentNode.getElementsByTagName("input"));
		x = ele.parentNode.getElementsByTagName("input");
		for (i=0;i<x.length;i++)
		{	
			if (x[i].getAttribute("id")=='ajaxok'){
				x[i].value='luan';
				break;
			}
			
		}
		
	}

	
</script>
<script type="text/javascript">

function showdetail(){
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		    //alert(xmlhttp.responseText);
	        document.getElementById("ajaxdelete").innerHTML=xmlhttp.responseText;
	    }
	  }
	xmlhttp.open("GET","ajax/project_command.php",true);
	xmlhttp.send();
}

var doctitle="";
var doctil="";
var doctilc="424242";
function addStyle1ColorCommand(ele){
	 doctitle = $(ele).parent().parent().parent().find("#titlecomment");	 
	 doctitle.css("color","#B023AB");
	 doctilc = "B023AB";
}

function addStyle2ColorCommand(ele){
	 doctitle = $(ele).parent().parent().parent().find("#titlecomment");	 
	 doctitle.css("color","#B02323");
	 doctilc = "B02323";
}

function addStyle3ColorCommand(ele){
	 doctitle = $(ele).parent().parent().parent().find("#titlecomment");	 
	 doctitle.css("color","#3DA850");
	 doctilc = "3DA850";
}


function addStyleColorButton1(){
	 doctitle = document.getElementById('titleerror');
	 doctitle.style.color = '#B023AB';
	 $('#titleerrorhidden').val('B023AB');
}	
function addStyleColorButton2(){
	 doctitle = document.getElementById('titleerror');
	 doctitle.style.color = '#B02323';
	 $('#titleerrorhidden').val('B02323');
} 
function addStyleColorButton3(){
	 doctitle = document.getElementById('titleerror');
	 doctitle.style.color = '#3DA850';
	 $('#titleerrorhidden').val('3DA850');
}


function setTitleValues_EditPro(){
	if(doctil==""){
		document.formadderror.titleerror.value = document.getElementById('titleerror').value+"-%$#@!-#424242";
	}else{
		alert('color title === ' + document.formadderror.titleerror.value);
		document.formadderror.titleerror.value =doctil;
	}
}

function viewcommanderrorrebind(indexcomment,idtestproject,id_employee,id,recyclebin,ele)
{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
			   // alert(xmlhttp.responseText);
		        $(ele).parent().parent().parent().next("tr").html(xmlhttp.responseText);
		        $("#report tr.odd:not(#mo)").show();
				$("#report tr:not(.odd):not(#mo)").hide();
				$(ele).parent().parent().parent().hide();
		    	$(ele).parent().parent().parent().next("tr").toggle();
		    }
		  }
	//	var cont = "comment-project-hide.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&id="+id;
		//alert(cont);
		//var contenttestpro = $(ele).find("#c_hidden").val();
		var lang = '<?=$_SESSION['lang']?>';
		xmlhttp.open("GET","admin/project/show_comment_rebin.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&idproject="+id+"&recyclebin="+recyclebin+"&newlang="+lang,true);
		xmlhttp.setRequestHeader("Content-Type", "charset=utf-8");
		xmlhttp.send();

}

function viewcommanderror(indexcomment,idtestproject,id_employee,id,recyclebin,ele)
{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
			   // alert(xmlhttp.responseText);
		        $(ele).parent().parent().parent().next("tr").html(xmlhttp.responseText);
		        $("#report tr.odd:not(#mo)").show();
				$("#report tr:not(.odd):not(#mo)").hide();
				$(ele).parent().parent().parent().hide();
		    	$(ele).parent().parent().parent().next("tr").toggle();
		    }
		  }
	//	var cont = "comment-project-hide.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&id="+id;
		//alert(cont);
		//var contenttestpro = $(ele).find("#c_hidden").val();
		var lang = '<?=$_SESSION['lang']?>';
		xmlhttp.open("GET","admin/project/show_comment.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&idproject="+id+"&recyclebin="+recyclebin+"&newlang="+lang,true);
		xmlhttp.setRequestHeader("Content-Type", "charset=utf-8");
		xmlhttp.send();

}

function commentProjectHide(indexcomment,idtestproject,id_employee,id,recyclebin,ele)
{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
			   // alert(xmlhttp.responseText);
		        $(ele).parent().parent().parent().next("tr").html(xmlhttp.responseText);
		        $("#report tr.odd:not(#mo)").show();
				$("#report tr:not(.odd):not(#mo)").hide();
				$(ele).parent().parent().parent().hide();
		    	$(ele).parent().parent().parent().next("tr").toggle();
		    }
		  }
	//	var cont = "comment-project-hide.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&id="+id;
		//alert(cont);
		//var contenttestpro = $(ele).find("#c_hidden").val();
		var lang = '<?=$_SESSION['lang']?>';
		xmlhttp.open("GET","admin/project/show_comment.php?indexcomment="+indexcomment+"&idtestproject="+idtestproject+"&id_employee="+id_employee+"&idproject="+id+"&recyclebin="+recyclebin+"&newlang="+lang,true);
		xmlhttp.setRequestHeader("Content-Type", "charset=utf-8");
		xmlhttp.send();

}

function active_test_project(idtestproject,idp,idemployee,page,ele)
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	    //alert(xmlhttp.responseText);
        document.getElementById("aaa").innerHTML=xmlhttp.responseText;
        bindEventAfterAjax();
    }
  }
var lang = '<?=$_SESSION['lang']?>';
xmlhttp.open("GET","content-project/process-active-testproject.php?idtestproject="+idtestproject+"&id="+idp+"&idemp="+idemployee+"&newlang="+lang+"&page="+page,true);
xmlhttp.send();
}
</script>
<div id="contains" style="background-color: #edf4f7;">

<div class="title"></div>
<div class="main_content" id="accordion-js">

	<div class="projectInfo">
		<?php while ($row=mysql_fetch_array($querydetail)){ 
			$idmanager = $row[IDManager];
			
		?>
		<span class="caption"><?php echo $l_project?> : <i><?php echo $row[NameProject]?>
		</i> </span>
		<div class="divinvi" style="display: none">
			<table width="100%" cellspacing="5" cellpadding="0">
				<tr>
					<td width="150">- <?php echo $l_start_date?> :</td>
					<td class="underline"><?php echo $row[DateStart]?></td>
				</tr>
				<tr>
					<td width="150">- <?php echo $l_manager?> :</td>					
					<td class="underline"><?php echo  $row[FullName];?>
					</td>
				</tr>
				<tr>
					<td width="150">- <?php echo $l_status?> :</td>
					<td class="underline"><?php 
					if($row[Status]==0){
						echo $l_status_project_no;
					}else{
						echo $l_status_project_done;
					}
					?>
					</td>
				</tr>
				<tr>
					<td width="150">- <?php echo $l_description?> :</td>
					<td class="underline"><?php echo $row[Description]?></td>
				</tr>
			</table>
		</div>
	</div>
	<?php }?>

	<div class="teamPro">
		<a class="caption"><?php echo $l_listmember?> </a>
		<div class="divinvi" style="display: none">
			<table cellspacing="3" width="100%" style="margin-bottom: 20px"
				class="listCom">
				<tr>
					<td class="titleComp"><?php echo $l_tester_team?></td>
					<td class="titleComp"><?php echo $l_coder_team?></td>
				</tr>

				<tr>
					<?php 
					$row_array = array();
					$index = 0;
					while ($row = mysql_fetch_array($queryLstMember)){
							$row_array[$index][0] = $row[IDEmployee];
							$row_array[$index][1] = $row[Position];
							$row_array[$index][2] = $row[FullName];
							$row_array[$index][3] = $row[Status];
							$index += 1;
						}
						?>
					<td style="vertical-align: top">
						<ul class="composition">
						<?php 
						foreach ($row_array as $row){
						if(($row[0]==$_SESSION['IDEmployee']) && ($row[1]==0)){
							$_SESSION['postest']=1;
						}
						if($row[1]==0){?>
							<li class="itemCom"><?php 	echo $row[2];
							if($row[3]==1) echo "<font style='font-weight: bold;'> (Not working)</font>";
							?>
							</li>
							<?php }} ?>
						</ul>
					</td>
					<td style="vertical-align: top">
						<ul class="composition">
						<?php
						foreach ($row_array as $rowCoder){
						 if($rowCoder[1]==1){?>
							<li class="itemCom"><?php 	echo $rowCoder[2];
							if($rowCoder[3]==1) echo "<font style='font-weight: bold;'> (Not working)</font>";
							?>
							</li>
							<?php } ?>
							<?php }?>
						</ul>
					</td>
				</tr>

			</table>
			<div align="right" style="margin-top:10px">
			<a href="project_admin.php?content=admin/project/updatecomposition.php&id=<?=$id?>"><span class="buttonProject" style="padding: 5px; border:1px solid #999"><?=$l_update?></span></a>
			</div>
		</div>
	</div>
	<? include 'inlude_error.php';?>
</div>
</div>
				